package star.搜索与回溯.二叉树镜像;

public class MirrorTree {
    TreeNode temp = null;
    public TreeNode mirrorTree(TreeNode root) {
        if (root==null) return null;
        swap(root);
        return root;
    }
    public void swap(TreeNode root){
        if (root==null) return;
        temp = root.left;
        root.left = root.right;
        root.right = temp;
        swap(root.left);
        swap(root.right);
    }
}
